﻿//-----------------------------------------------------------------------
// <copyright file="UtilityController.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: UtilityController.cs
// * history : created by qinchaoyue 2017-12-15 10:07:32
// </copyright>
//-----------------------------------------------------------------------

namespace WebApplication.Controllers
{
    using Microsoft.AspNetCore.Mvc;

    using Slwy.Application.Dtos;
    using Slwy.Mvc.Controller;
    using Slwy.Utility.Helper;

    [Route("api/test/[controller]")]
    public class UtilityController : SlwyController
    {
        [HttpPost("jsonfile")]
        public void SaveJsonFile([FromBody]ByAccountIdInDto inDto)
        {
            JsonFileHelper<ByAccountIdInDto>.WriteByFileName(inDto, "Account.json");
        }

        [HttpGet("jsonfile")]
        public IActionResult ReadJsonFile(JsonFileInDto inDto)
        {
            var a = inDto.FileName;
            var dto = JsonFileHelper<ByAccountIdInDto>.ReadByFileName("Account.json");
            return this.Ok(dto);
        }
    }
}
